﻿<UserControl x:Class="IS_Ever_Green.View.LaptopView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:IS_Ever_Green.View" 
             xmlns:viewModel="clr-namespace:IS_Ever_Green.ViewModel"
             mc:Ignorable="d" 
             d:DesignHeight="2000"
             d:DesignWidth="1100"
             >
    
    <UserControl.DataContext>
        <viewModel:LaptopViewModel/>
    </UserControl.DataContext>

    <Border CornerRadius="16" 
            Margin="0 30 0 0"
            >

        <ScrollViewer>
            <StackPanel Orientation="Vertical">

                <TextBlock Text="{Binding TextLaptop}"
                       Foreground="{StaticResource primaryTextColor}"
                       FontSize="30"
                       FontWeight="Medium"
                       FontFamily="Montserrat"
                       VerticalAlignment="Center"
                       HorizontalAlignment="Center"
                       />

                <ListBox Name="Accessories"
                         Background="Transparent"
                         BorderThickness="0"
                         ItemsSource="{Binding LaptopList}"
                         >

                    <ListBox.Style>
                        <Style TargetType="ListBox">
                            <Style.Setters>
                                <Setter Property="Foreground" Value="Transparent"/>
                                <Setter Property="Background" Value="Transparent"/>
                                <Setter Property="IsHitTestVisible" Value="False"/>
                                <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
                            </Style.Setters>
                            <Style.Triggers>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="Background" Value="Transparent"/>
                                    <Setter Property="Foreground" Value="Transparent"/>
                                </Trigger>
                            </Style.Triggers>
                        </Style>
                    </ListBox.Style>

                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <Border CornerRadius="16"
                                    Width="300"
                                    Height="350"
                                    Margin="35 50 0 50"
                                    Background="{StaticResource panelContentColor}">

                                <StackPanel Orientation="Vertical">
                                    <Grid>
                                        <Grid.RowDefinitions>
                                            <RowDefinition/>
                                            <RowDefinition Height="100"/>
                                            <RowDefinition Height="40"/>
                                            <RowDefinition/>
                                        </Grid.RowDefinitions>

                                        <Border CornerRadius="75"
                                                Width="150"
                                                Height="150"
                                                Grid.Row="0"
                                                Margin="0 20 0 0"
                                                >

                                            <Image Source="{Binding PhotoProduct}"/>

                                        </Border>

                                        <StackPanel Orientation="Vertical" 
                                                    Width="250"
                                                    Grid.Row="1"
                                                    Margin="0 10 0 0"
                                                    >

                                            <TextBlock Text="{Binding Name}"
                                                       Foreground="{StaticResource primaryTextColor}"
                                                       FontSize="15"
                                                       FontWeight="Medium"
                                                       FontFamily="Montserrat"
                                                       VerticalAlignment="Center"
                                                       HorizontalAlignment="Center"
                                                       Grid.RowSpan="1"
                                                       Grid.ColumnSpan="3"
                                                       TextWrapping="Wrap"
                                                       Margin="15 0 15 0"
                                                       />

                                        </StackPanel>

                                        <Grid VerticalAlignment="Bottom"
                                              Margin="15 0 15 0"
                                              Grid.Row="2"
                                              >

                                            <TextBlock Text="Цена:"
                                                       Foreground="{StaticResource primaryTextColor}"
                                                       FontSize="15"
                                                       FontWeight="Medium"
                                                       FontFamily="Montserrat"
                                                       Margin="20 0 0 0"
                                                       />

                                            <TextBlock Text="{Binding Price}"
                                                       Foreground="{StaticResource primaryTextColor}"
                                                       FontSize="15"
                                                       FontWeight="Medium"
                                                       FontFamily="Montserrat"
                                                       Margin="70 0 0 0"
                                                       />

                                        </Grid>

                                        <StackPanel Orientation="Horizontal"
                                                    HorizontalAlignment="Right"
                                                    Grid.Row="3"
                                                    >   

                                            <Image Grid.Row="4" 
                                                   VerticalAlignment="Center" 
                                                   HorizontalAlignment="Right" 
                                                   Margin="0 0 15 0" 
                                                   Width="30" 
                                                   Height="30" 
                                                   Source="/Images/Cart.png"
                                                   />

                                            <Image Grid.Row="4" 
                                                   VerticalAlignment="Center" 
                                                   HorizontalAlignment="Right" 
                                                   Margin="0 0 20 0"
                                                   Width="30" 
                                                   Height="30" 
                                                   Source="/Images/LikeProduct.png"
                                                   />

                                        </StackPanel>
                                    </Grid>
                                </StackPanel>

                            </Border>
                        </DataTemplate>
                    </ListBox.ItemTemplate>

                    <ListBox.ItemsPanel>
                        <ItemsPanelTemplate>
                            <VirtualizingStackPanel Orientation="Horizontal"/>
                        </ItemsPanelTemplate>
                    </ListBox.ItemsPanel>

                </ListBox>
            </StackPanel>
        </ScrollViewer>

    </Border>
</UserControl>
